import 'package:test/test.dart';

import 'package:sow_app_mock/sow_app_mock.dart';

void main() {
  group('search controller test group', () {
    final MockSearchPresenter presenter = MockSearchPresenter();
    final controller = MockSearchController(presenter);
    test(
        "should present valid search novel list and search list data when invoke getSearchNovelList",
        () async {
      await controller.searchByText("9");
      await Future.doWhile(() => presenter.flag = false);
      expect(presenter.searchNovelList, isNotEmpty);
      expect(presenter.searchList, isNotEmpty);
    });
    test("should present empty search list data when invoke clearSearchHistory",
        () async {
      await controller.clearSearchHistory();
      await Future.doWhile(() => presenter.flag = false);
      expect(presenter.searchList, isEmpty);
    });
  });
}
